package com.ybcj.service.impl;

import com.ybcj.dao.EmpDao;
import com.ybcj.pojo.Emp;
import com.ybcj.service.EmpService;
import jakarta.websocket.server.ServerEndpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;

//@Component
@Service
public class EmpServiceB implements EmpService {
    @Autowired
    private EmpDao empDao;
//    private EmpDao empDao = new EmpDaoA();

    @Override
    public List<Emp> listEmp() {

        List<Emp> listEmp = empDao.listEmp();

        // 数据处理
        listEmp.stream().forEach(emp -> {
            if("1".equals(emp.getGender())
            ){
                emp.setGender("男人");
            }else if("2".equals(emp.getGender())){
                emp.setGender("女人");
            }

            if("1".equals(emp.getJob())){
                emp.setJob("讲师");
            } else if ("2".equals(emp.getJob())) {
                emp.setJob("班主任");
            } else if ("3".equals(emp.getJob())) {
                emp.setJob("就业指导");
            }
        });

        return listEmp;
    }
}
